package cn.luischen.utils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.rules.ExpectedException;
import org.junit.Test;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
import java.lang.reflect.Method;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.ParserConfig;
import java.util.Map;
import java.util.List;
import com.unitspirit.runtime.*;

/**
 * The class contains tests for the class cn.luischen.utils.MapCache.
 *
 * @generatedBy UnitSpirit CreateTemplateTestFile4
 * @version 1.0.9.11 
 */
@PowerMockIgnore({ "javax.management.*" })
public class MapCache_hget_WGTest {
	@Rule
	public ExpectedException unitspirit_thrown = ExpectedException.none();

	/**
	 * 测试方法初始化.
	 * 
	 * @throws Exception 
	 *         if the initialization fails for some reason 
	 *  
	 * @generatedBy UnitSpirit at 2021-11-26 11:32:07
	 */
	@org.junit.Before
	public void setUp() throws Exception {
		try {
			GlobalUnitInit.init();
			MockitoAnnotations.initMocks(this);
			ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	/**
	 * @date 2021-11-26 11:32:07
	 * @see cn.luischen.utils.MapCache#hget
	 * @category auto generate by UnitSpirit  
	 */
	@Test
	public void test_hget_20211109_110317_805_1_00() throws Throwable {

		cn.luischen.utils.MapCache unitspirit_fixture = new cn.luischen.utils.MapCache();
		unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
		String String_p_0 = "login_error_count";
		String String_p_1 = "127.0.0.1";
		//成员变量设置

		//返回值定义 
		String result_expected = null;

		Object mock_result_Object1 = null;
		PowerMockito.doReturn(mock_result_Object1).when(unitspirit_fixture)
				.get(anyString());

		Object unitspirit_result = (Object) unitspirit_fixture.hget(String_p_0,
				String_p_1);
		assertNull(unitspirit_result);
	}

	/**
	 * @date 2021-11-26 11:32:07
	 * @see cn.luischen.utils.MapCache#hget
	 * @category auto generate by UnitSpirit  
	 */
	@Test
	public void test_hget_20211111_133429_636_1_00() throws Throwable {

		cn.luischen.utils.MapCache unitspirit_fixture = new cn.luischen.utils.MapCache();
		unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
		String String_p_0 = "login_error_count";
		String String_p_1 = "127.0.0.1";
		//成员变量设置

		//返回值定义 
		String result_expected = "1";

		Integer mock_result_Integer1 = 1;
		PowerMockito.doReturn(mock_result_Integer1).when(unitspirit_fixture)
				.get(anyString());

		Integer unitspirit_result = (Integer) unitspirit_fixture.hget(
				String_p_0, String_p_1);
		UnitAssert.assertEquals(result_expected,
				UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}
}
